﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace pwestcott.Util.Tests.Essence.CompareTo
{
    [TestFixture]
    public class CompareToOptions
    {
        class TestEssence
        {
            public TestEssence(int x)
            {
                this.X = x;
            }

            [Essence]
            public int X;
        }

        class TestEssenceReverse
        {
            public TestEssenceReverse(int x)
            {
                this.X = x;
            }

            [Essence(CompareToOptions = EssenceCompareToOptions.Reverse)]
            public int X;
        }

        [Test]
        public void TestReverse()
        {
            var baseTe = new TestEssence(5);
            var baseTer = new TestEssenceReverse(5);

            for (int i = 0; i < 10; ++i)
            {
                var te = new TestEssence(i);
                var ter = new TestEssenceReverse(i);

                var std = Essence<TestEssence>.CompareToStatic(baseTe, te);
                var rvs = Essence<TestEssenceReverse>.CompareToStatic(baseTer, ter);

                Assert.AreEqual(std, rvs * -1);
            }
        }
    }
}
